package com.chainyoung.component_tmtrade.ui.mvp.presenter;

import com.chainyoung.common.base.CommonSubscriber;
import com.chainyoung.common.di.scope.ActivityScope;
import com.chainyoung.common.mvp.BasePresenter;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmtrade.bean.RegionList;
import com.chainyoung.component_tmtrade.ui.mvp.contract.TradeCurrencyTypeListContract;

import javax.inject.Inject;

@ActivityScope
public class TradeCurrencyTypeListPresenter extends BasePresenter<TradeCurrencyTypeListContract.Model, TradeCurrencyTypeListContract.View> {

    @Inject
    public TradeCurrencyTypeListPresenter(TradeCurrencyTypeListContract.Model model, TradeCurrencyTypeListContract.View view) {
        super(model, view);
    }


    public void getMarketCurrencys() {
        addSubscribe(
                mModel.getCurrencyTypeList()
                        .compose(RxUtils.<RegionList>rxSchedulerHelper())
                        .subscribeWith(new CommonSubscriber<RegionList>(mView) {
                            @Override
                            public void onNext(RegionList data) {
                                mView.showMarketCurrencys(data);
                            }
                        })
        );
    }


}

